package main

import (
	"fmt"
	"time"

	"github.com/nathan-osman/go-rpigpio"
)

//const (
//	LEDA_P = 2
//	CS_P   = 3
//	RST_P  = 4
//	RS_P   = 5
//	SDA_P  = 6
//)

func main() {

	//	ps := Set_pin(LEDA_P, CS_P, RST_P, RS_P, SDA_P)

	fmt.Println("start gpio test")
	//Initlcd()
	yi := []uint8{
		/*--  文字:  一  --*/
		/*--  宋体9;  此字体下对应的点阵为：宽x高=15x15   --*/
		/*--  高度不是8的倍数，现调整为：宽度x高度=15x16  --*/
		0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
	//Writecomdate(3, 77, yi)

	fmt.Println("start yi test", yi[0])
	go func() {
		a := 1
		fmt.Println("start func test", yi[a], a)
		for {
			fmt.Println("start yi test", yi[a], a)
			a++
			if a >= 29 {
				a = 1
			}
			cs.Write(rpi.LOW)
			time.Sleep(time.Millisecond * 50)
			//			rs.Write(rpi.HIGH)
			//			time.Sleep(time.Millisecond * 100)
			//			sda.Write(rpi.LOW)
			//			time.Sleep(time.Millisecond * 100)

			cs.Write(rpi.HIGH)
			time.Sleep(time.Millisecond * 50)
			//			rs.Write(rpi.LOW)
			//			time.Sleep(time.Millisecond * 100)
			//			sda.Write(rpi.HIGH)
			//			time.Sleep(time.Millisecond * 100)
		}
	}()

	time.Sleep(time.Hour * 2)
}
